import React, { Component } from 'react';
import connect from './connect'
import Header from './ui/Header'
import SearchNav from '@/components/SearchNav'
import List from './ui/List'
import List2 from './ui/List2'

@connect
class index extends Component {
    state = {
        listDataIndex: 0,
        setListDataIndex: (index) => this.setState({ listDataIndex: index })
    }
    componentDidMount() {
        this.props.getCategoryData()

        this.props.getMaterialData()
    }
    render() {
        return (
            <div style={{ height: "100%", overflow: 'hidden' }}>
                {/* 头部分类 */}
                <Header {...this.state} />

                {/* 搜索 */}
                <SearchNav />
                {
                    this.state.listDataIndex === 0
                        ?
                        // {/* 分类内容 */}
                        <List listDataIndex={this.state.listDataIndex} />
                        :
                        <List2 />
                }

            </div>
        );
    }
}

export default index;
